package cc.mycraft.events;

import java.util.Date;

import org.bukkit.Location;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public final class PlayerLogEvent extends Event {
	
	private static final HandlerList handlers = new HandlerList();

	@Override
	public HandlerList getHandlers() {
		return handlers;
	}
	
	public static HandlerList getHandlerList() {
		return handlers;
	}
	
	private byte logType;
	private String obj;
	private String actobj;
	private String extraLog;
	private long time;
	private String action;
	private boolean showBukkit;
	private Location objloc;
	private Location actloc;
	
	public PlayerLogEvent(byte LogType,String objString,Location objLoc,String action,String actObj,Location actLoc,String extraLog,boolean showBukkit) {
		this.logType = LogType;
		this.obj = objString;
		this.actobj = actObj;
		this.action = action;
		this.objloc = objLoc;
		this.actloc = actLoc;
		this.extraLog = extraLog;
		this.showBukkit = showBukkit;
		this.time = new Date().getTime();
	}
	public long getTime() {
		return this.time;
	}
	public boolean isShowBukkit() {
		return this.showBukkit;
	}
	public String getObj() {
		return this.obj;
	}
	public String getActObj() {
		return this.actobj;
	}
	public String getAction() {
		return this.action;
	}
	public String getObjLoc() {
		if(this.objloc==null) {
			return "NONE";
		}
		return this.objloc.getWorld().getName()+","+this.objloc.getBlockX()+","+this.objloc.getBlockY()+","+this.objloc.getBlockZ();
	}
	public String getActLoc() {
		if(this.actloc==null) {
			return "NONE";
		}
		return this.actloc.getWorld().getName()+","+this.actloc.getBlockX()+","+this.actloc.getBlockY()+","+this.actloc.getBlockZ();
	}
	public String getExtra() {
		if(this.extraLog==null) {
			return "NONE";
		}
		return this.extraLog;
	}
	public byte getLogType() {
		return this.logType;
	}
}
